﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

using IronOne.SalesOne.BusinessObjects;
using IronOne.SalesOne.DataObjects;

namespace Facade
{
    public class CustomerFacade
    {
        


        #region Customer
        LinqCustomer linqCustomer = new LinqCustomer();
        LinqNeedAnalysis liqNeedAnalysis = new LinqNeedAnalysis();
        
        [DataObjectMethod(DataObjectMethodType.Select)]
        public Customer GetCustomerByProspectId(string prosId)
        {
            return linqCustomer.GetCustomerByProspectId(prosId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Customer GetCustomerByContractId(string contractId)
        {
            return linqCustomer.GetCustomerByContractId(contractId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Customer GetCustomer(string customerId)
        {
            return linqCustomer.GetCustomer(customerId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Customer> GetUser(string sortExpression)
        {
            return linqCustomer.GetCustomers(sortExpression);
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public void InsertCustomer(Customer customer)
        {
            linqCustomer.InsertCustomer(customer);
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateUser(Customer customer)
        {
            return linqCustomer.UpdateCustomer(customer);
        }


        [DataObjectMethod(DataObjectMethodType.Delete)]
        public int DeleteUser(Customer customer)
        {
            return linqCustomer.DeleteCustomer(customer);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Customer> SearchCustomers(ContactSearch cust,int pageNo)
        {
            return linqCustomer.SearchCustomers(cust, "Client", pageNo);
        }

        //[DataObjectMethod(DataObjectMethodType.Select)]
        //public string GetSOForCustomer(string customerId)
        //{
        //    return linqCustomer.GetSOForCustomer(customerId);
        //}

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<NeedsAnalysis> GetNeedAnalysisCustomers(NeedAnalysisSearch na,int pageNo)
        {
            return liqNeedAnalysis.GetNeedAnalysisCustomers(na, pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public NeedsAnalysis GetNeedAnalysis(int needAnNo)
        {
            return liqNeedAnalysis.GetNeedAnalysis(needAnNo);
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public  int UpdateNeedAnalysis(NeedsAnalysis need)
        {
            return liqNeedAnalysis.UpdateNeedAnalysis(need);
        }


        #endregion

        #region Policy
        LinqPolicy pol = new LinqPolicy();

        

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Policy GetPolicy(string contractId)
        {
            return pol.GetPolicy(contractId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Policy> GetPolicies(string sortExpression)
        {
            return pol.GetPolicies(sortExpression);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Policy> SearchPolicies(string idNo, string idType, string custName, string customerId, string contactNo, string branchId, string unitId, string soCode)
        {
            return pol.SearchPolicies(idNo,idType,custName,customerId,contactNo,branchId,unitId,soCode);
        }


        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Policy> SearchPolicies(ContactSearch polcy,int pageNo)
        {
            return pol.SearchPolicies(polcy, pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Policy> SearchAckSlips(SearchCS ack, int pageNo)
        {
            return pol.SearchAckSlips(ack,pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Claim> searchClaim(SearchCS cl, int pageNo)
        {
            return pol.searchClaim(cl, pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Policy> GetPoliciesForClient(string clientId,string so)
        {
            return pol.GetPoliciesForClient(clientId,so);
        }
       

        #endregion

        #region Prospect
        LinqProspect pros = new LinqProspect();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Prospect GetProspect(string prospectId)
        {
            return pros.GetProspect(prospectId);
        }

        //[DataObjectMethod(DataObjectMethodType.Select)]
        //public Prospect GetPolicy(string prosp)
        //{
        //    return pros.GetProspect(prosp);
        //}

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Prospect> GetProspects(string sortExpression)
        {
            return pros.GetProspects(sortExpression);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Customer> SearchProspects(ContactSearch prospect,int pageNo)
        {
            return linqCustomer.SearchCustomers(prospect,"Prospect",pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Prospect GetProspForCustomer(string customerId)
        {
            return pros.GetProspForCustomer(customerId);
        }

        #endregion

        #region Spouse

        LinqSpouse spo = new LinqSpouse();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Spouse GetSpouseForCustomer(string customerId)
        {
            return spo.GetSpouseForCustomer(customerId);
        }

        #endregion

        #region Dependent

        LinqDependant dep = new LinqDependant();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Dependant> GetDependentsForCustomer(string customerId, int pageNo)
        {
            return dep.GetDependentsForCustomer(customerId,pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<NaDependent> GetDependentsForNa(int needAn, int pageNo)
        {
            return dep.GetDependentsForNa(needAn,pageNo);
        }



        #endregion

        #region Suspect
        LinqSuspect susp = new LinqSuspect();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Customer> SearchSuspects(ContactSearch suspect,int pageNo)
        {
            return linqCustomer.SearchCustomers(suspect, "Suspect",pageNo);
        }


        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateSuspect(Suspect suspect)
        {
            return susp.UpdateSuspect(suspect);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Suspect GetSuspect(string susId)
        {
            return susp.GetSuspect(susId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Suspect GetSuspForCustomer(string customerId)
        {
            return susp.GetSuspForCustomer(customerId);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Customer> GetSuspectsForBranch(List<Branch> brnch, int pageNo)
        {
            return susp.GetSuspectsForBranch(brnch, pageNo);
        }


        #endregion

        #region PendingProposal

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<PendingProposal> SearchPendProps(SearchCS pep, int pageNo)
        {
            return pol.SearchPendProps(pep, pageNo);
        }

        #endregion

        #region Complaint

        LinqComplaint compl = new LinqComplaint();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Complaint> SearchComplaint(SearchCS comp,int pageNo)
        {
            return compl.SearchComplaint(comp,pageNo);
        }


        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateComplaint(Complaint comp)
        {
            return compl.UpdateComplaint(comp);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Complaint GetComplaint(string ComplaintId)
        {
            return compl.GetComplaint(ComplaintId);
        }

        #endregion
    }
}
